<template>
  <div class="permission">
    <h2>v-permission指令</h2>
    <div class="permission-box">
      <van-button v-if="hasPermission" type="primary" size="small" plain >战士</van-button>
      <van-button v-permission="{id:'userManager',type:'4'}"  type="primary" size="small" plain >法师</van-button>
      <van-button v-permission="{id:'userManager',type:'5'}" type="primary" size="small" plain >道士</van-button>
    </div>
  </div>
</template>
<script setup lang="ts">
  import {onMounted,ref } from 'vue'
  import { getPermission } from "@/utils/index"

  const hasPermission  = ref(true)
  const date = ref('2022-2-8')
  const month = ref<string | number>('9')
  month.value = 10
  //console.log('更改month的值',month)
  const result = date.value.split('-')
  //console.log('------result-----',result)
  
  onMounted(() =>{
    hasPermission.value = getPermission(null,'appManager','6')
  })
</script>
<style lang="scss" scoped>
.permission {
  padding: 20px;
  .permission-box {
    margin: 10px 0;
    .van-button {
      margin-right: 10px;
    }
  }
}

</style>
